package com.alex.zookeeper.crud;


import com.alex.zookeeper.BaseTest;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.data.Stat;
import org.junit.Test;

/**
 * 检查节点是否存在
 */
public class ZKExists extends BaseTest {

    @Test
    public void sync() throws Exception {
        Stat stat = zooKeeper.exists(PATH, false);
    }

    @Test
    public void async() throws Exception {
        zooKeeper.exists(PATH, false, new AsyncCallback.StatCallback() {
            @Override
            public void processResult(int i, String s, Object o, Stat stat) {

            }
        }, "exists async");
    }
}
